import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)
import Home from '@/pages/Home'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import PersonalCenter from "@/pages/PersonalCenter";
import ModifyPersonalInfo from "@/pages/ModifyPersonalInfo";
import ArticleDetail from "@/pages/ArticleDetail";
import PublishArticle from "@/pages/PublishArticle";
// import BlogView from "@/pages/BlogView";
import OtherInfo from "@/pages/OtherInfo";
import ModifyArticle from "@/pages/ModifyArticle";
import AdviceCenter from "@/pages/AdviceCenter";
const routes = [
  {
    path: "/",
    name: "Home",
    component: Home
  },
  {
    path: "/login",
    name: "Login",
    component: Login
  },
  {
    path: "/register",
    name: "Register",
    component: Register
  },
  {
    path: "/personalCenter",
    name: "PersonalCenter",
    component: PersonalCenter
  },
  {
    path: "/modifyPersonalInfo",
    name: "ModifyPersonalInfo",
    component: ModifyPersonalInfo
  },
  {
    path: "/articleDetail",
    name: "ArticleDetail",
    component: ArticleDetail
  },
  {
    path: "/otherInfo",
    name: "OtherInfo",
    component: OtherInfo
  },
  {
    path: "/publishArticle",
    name: "PublishArticle",
    component: PublishArticle
  },
  {
    path: "/modifyArticle",
    name: "ModifyArticle",
    component: ModifyArticle
  },
  {
    path: "/adviceCenter",
    name: "AdviceCenter",
    component: AdviceCenter
  },

]


//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})



export default router
